package com.frejoys.service;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.frejoys.dao.entity.Verify;

public interface VerifyService extends IService<Verify> {

    default Verify getOnly(QueryWrapper<Verify> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    default Verify getOnly(LambdaQueryWrapper<Verify> wrapper) {
        wrapper.last("limit 1");
        return this.getOne(wrapper);
    }

    /**
     * 获取有效时间内未验证的账户
     * @param accountExtend
     * @param account
     * @param type
     * @param code
     * @return
     */
    Integer getValidSmsId(String accountExtend, String account, Integer type, String code);

    /**
     * 发送验证码
     * @param accountExtend
     * @param account
     * @param type
     * @return
     */
    boolean sendVerifyCode(String accountExtend, String account, Integer type);

    /**
     * 验证验证码
     * @param accountExtend
     * @param account
     * @param type
     * @param code
     * @return
     */
    boolean verifyCode(String accountExtend, String account, Integer type, String code);


}
